<!DOCTYPE html>
<!-- 
	http://www.axios-js.com/zh-cn/docs/
	
	https://blog.csdn.net/CRMEB/article/details/113121134
 -->
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<title></title>
		<!-- <script src="https://unpkg.com/axios/dist/axios.min.js"></script> -->
		<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
		<script>
			// const url = 'https://172.28.112.1:8006/userList'
				// const url = 'https://www.baidu.com'
			const url ='https://megapp.casinomegafish.com/api/app/v1/device/start'
			// https://www.axios-http.cn/docs/req_config 
			function testAxiosRequest(){
			
				axios({
					method:'get',
					url:url,
					headers:{
						appId:'CasinoMegaFish'
					}
				}).then(res =>{
					console.log("返回结果："+res.data)
				}).catch(error =>{
					//Axios的error处理 https://www.jianshu.com/p/45332e70beaa
					if (error.response) {
					      // The request was made and the server responded with a status code
					      // that falls out of the range of 2xx
					      console.log(error.response.data);
					      console.log(error.response.status);
					      console.log(error.response.headers);
					    } else if (error.request) {
					      // The request was made but no response was received
					      // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
					      // http.ClientRequest in node.js
					      console.log(error.request);
					    } else {
					      // Something happened in setting up the request that triggered an Error
					      console.log('Error', error.message);
					    }
					    console.log(error.config);
				})
			}
			
		</script>
		
	</head>
	<body style="background-color: aqua;">
		<div id="getBaiduData" onclick="testAxiosRequest()" style="position: absolute; margin-left: 100px; margin-top: 200px;">加载数据</div>
	
	</body>
</html>